<?php
	$items = $self->getCollection();
?>
<div class="content-header row-fluid">
	<h3 class="pull-left"><?php echo $self->getTitle() ?></h3>
	<div class="actions pull-right">
		<a href="<?php echo $self->getNewUrl() ?>" class="btn">Add</a>
	</div>
</div>

<div class="toolbar-top">
<?php $self->renderChild('toolbar') ?>
</div>

<form method="GET">
<input type="submit" class="hide" vlue="search" />
<table class="table table-bordered table-hover">
	<colgroup>
		<col/>
		<col width="150"/>
	</colgroup>

	<thead>
		<tr>
			<th><a href="<?php echo $self->getOrderUrl('name') ?>">
				<i class="<?php echo $self->getClass('name') ?>"></i>
				Name
			</a></th>
			<th><a href="<?php echo $self->getOrderUrl('post_count') ?>">
				<i class="<?php echo $self->getClass('post_count') ?>"></i>
				Post Count
			</a></th>
		</tr>
		<tr>
			<th>
				<input type="text" name="name" value="<?php echo App::get('name') ?>" class="span24" />
			</th>
			<th>
				<input type="text" name="post_count" value="<?php echo App::get('post_count') ?>" class="span24" />
			</th>
		</tr>
	</thead>
	
	<tbody>
		<?php foreach($items as $item): ?>
		<tr title="<?php echo $self->getRowUrl($item->getId()) ?>">
			<td><?php echo $item->getName() ?></td>
			<td><?php echo $item->getPostCount() ?></td>
		</tr>
		<?php endforeach ?>
	</tbody>
</table>
</form>

<div class="toolbar-bottom">
<?php $self->renderChild('toolbar') ?>
</div>

<script type="text/javascript">
//<![CDATA[
$('.table tbody tr').click(function () {
	setLocation(this.title);
});
//]]>
</script>
